package no.kolstad.movies.webapp.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import no.kolstad.movies.service.GenericManager;
import no.kolstad.movies.model.Loaner;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class LoanerController implements Controller {
    private GenericManager<Loaner, Long> loanerManager;

    public void setLoanerManager(GenericManager<Loaner, Long> loanerManager) {
        this.loanerManager = loanerManager;
    }

    public ModelAndView handleRequest(HttpServletRequest request,
                                      HttpServletResponse response)
    throws Exception {
        return new ModelAndView().addObject(loanerManager.getAll());
    }
}
